package com.example.badmintonDB.Server;

import com.example.badmintonCommon.entity.Gym;
import com.example.badmintonCommon.entity.Order;
import com.example.badmintonDB.GymDBserver;
import com.example.badmintonDB.dao.GymMapper;
import com.example.badmintonDB.dao.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GymDBServerImpl implements GymDBserver {
    private final UserMapper userMapper;
    private final GymMapper gymMapper;
    @Autowired
    public GymDBServerImpl(UserMapper userMapper,GymMapper gymMapper){
        this.userMapper=userMapper;
        this.gymMapper=gymMapper;
    }
    //查看所有体育馆基本信息
    @Override
    public List<Gym> FindAllGyms(){
        return gymMapper.FindAllGyms();
    }

    //查看体育馆具体信息
    @Override
    public Gym FindGymMes(Integer id){
        return gymMapper.FindGymMes(id);
    }

    //预定（取消）体育馆预定信息
   @Override
    public void UpdateGymPlace(Integer id, int[][] place){
        gymMapper.updateGymPlaces(id,place);
    };


    //创造订单
    @Override
    public void CreateOder(Order oder) {
        gymMapper.CreateOder(oder);
    };

    //取消订单
    @Override
    public void CancelOder(String oderId,String oderStatus) {
        gymMapper.CancelOder(oderId,oderStatus);
    };

    //获得订单信息
    @Override
    public Order FindOrderById(String oderid) {
        return gymMapper.FindOrderById(oderid);
    };

}
